package com.gxa.shop.service.favorite.Impl;

import com.gxa.shop.bean.pojo.Favorite;
import com.gxa.shop.bean.vo.FavoriteVo;
import com.gxa.shop.dao.favorite.FavoriteDao;
import com.gxa.shop.dao.favorite.Impl.FavoriteDaoImpl;
import com.gxa.shop.service.favorite.FavoriteService;

import java.util.Collections;
import java.util.List;

/**
 * com.gxa.shop.service.favorite.Impl
 * User: 刁彦侨
 * Date: 2024/12/23 10:49
 * motto:   逆水行舟不进则退
 * Description:
 * Version: V1.0
 */
public class FavoriteServiceImpl implements FavoriteService {
    private FavoriteDao favoriteDao = new FavoriteDaoImpl();

    @Override
    public List<FavoriteVo> findById(String id) {
        return favoriteDao.findById(id);
    }

    @Override
    public boolean addFavorite(Favorite favorite) {
        return favoriteDao.insert(favorite)>0;
    }

    @Override
    public boolean deleteFavorite(Integer userId, Integer productId) {
        return favoriteDao.deleteById(userId, productId)>0;
    }
}
